package handler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.dbutils.ResultSetHandler;

import drh.bean.Address;

public class AddressResultSetHandler implements ResultSetHandler<List<Address>> {

	@Override
	public List<Address> handle(ResultSet rs) throws SQLException {
		List<Address>list = new ArrayList<>();
		while(rs.next()) {
			Address info = new Address();
			info.setId(rs.getInt("id"));
			info.setUserid(rs.getInt("userid"));
			info.setAddress(rs.getString("address"));
			info.setIsdfault(rs.getString("isdfault"));
			info.setConsignee(rs.getString("consignee"));
			info.setTel(rs.getString("tel"));
			info.setTime(rs.getDate("time"));
			info.setIsdelete(rs.getInt("isdelete"));
			list.add(info);
		}
		return list;
	}
	
}
